"""
__author__ = 'heyanmin'
__time__ = '2021/8/8 2:47 下午'
"""
import pytest

from lianxi.SumCount import SumCount


def pytest_collection_modifyitems(items):
    """
    收集所有的测试用例----以下可以将unicode_escape编码转换为中文
    :return:
    """
    print("这是收集所有测试用例的方法--hook知识")
    for item in items:
        item.name = item.name.encode("utf-8").decode("unicode_escape")
        item._nodeid = item.nodeid.encode("utf-8").decode("unicode_escape")


@pytest.fixture()
def sum_init_fixture():
    # setup
    sum = SumCount()
    print("开始计算")
    yield sum
    #teardown
    print("结束计算")